NPTEL Problem Solving Through Programming in C | NPTEL Week 9 Quiz Assignment | NPTEL Assignment Solutions

NPTEL Problem Solving Through Programming in C Week 9 Quiz Assignment | NPTEL Swayam Assignment Answers


nptel problem solving through programming in C



Join Us On Telegram

     ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡

telegram


Join Us On Youtube

     ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡ðŸ‘‡

youtube



MCQs (multiple choice questions) Nptel Week 9 Quiz Answers:


Q.1: What is the best case complexity of ordered linear search and worst case complexity of selection sort respectively? Options are:

(a) O(1), O(n²)
(b) O(logn), O(1),
(c) O(n), O(logn)
(d) O(n²), O(nlogn)


Answer is: (a) O(1), O(n²)



Q.2: Which of the following is/are correct? Options are:

I.Binary search is applied when elements are sorted.
II.Linear search can be applied when elements are in random order.
III. Binary search can be categorized into divide and conquer rule.

(a) I & II
(b) Only I
(c) I and III
(d) I,II&III


Answer is: (d) I,II&III



Q.3: What is the recurrence relation for the linear search recursive algorithm? Options are:
    
(a) T(n-2)+c 
(b) 2T(n-1)+c
(c) T(n-1)+c 
(d) T(n+1)+c


Answer is: (c) T(n-1)+c



Q.4: Given an array arr = {20, 45, 77, 89, 91, 94, 98, 100} and key = 45; what are the mid values (corresponding array elements) generated in the first and second iterations? Options are:

(a) 91 and 98
(b) 89 and 45
(c) 89 and 77
(d) 91 and 94


Answer is: (b) 89 and 45


Q.5: Consider an array of elements A[7]= {10,4,7,23,67,12,5}, what will be the resultant array A after third pass of insertion sort. Options are:

(a) 67,12,10,5,4,7,23
(b) 4,7,10,23,67,12,5
(c) 4,5,7,67,10,12,23
(d) 10,7,4,67,23,12,5


Answer is: (b) 4,7,10,23,67,12,5


Q.6: Select the code snippet which performs unordered linear search iteratively? Options are:


select the code snippet which performs unordered linear search iteratively

select the code snippet which performs unordered linear search iteratively


Answer is: (a)



Q.7: Which of the following input will give worst case time complexity for selection sort to sort an array in ascending order? 

I. 1,2,3, 4, 5, 6, 7, 8
II. 8,7,6, 5, 4, 3, 2, 1
III. 8,7,5,6,3,2,1,4

Options are:

(a) I
(b) II
(c) II and III
(d) I,II and III


Answer is: (b) II



Q.8: Consider the array A[]= {5,4,9,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees, what is the total cost of the insertion sort for sorting the entire array? Options are:

(a) 25
(b) 50
(c) 75
(d) 100


Answer is: (c) 75


Q.9: A sorting technique is called stable if ? Options are:

(a) it takes O(nlog n ) time
(b) it maintainas the relative order of occurrence of non-distinct elements
(c) if uses divide and conquer paradigm
(d) it takes O(n) space


Answer is: (b) it maintainas the relative order of occurrence of non-distinct elements



Q.10: The average case occurs in the Linear Search Algorithm when ? Options are:

(a) The item to be searched is in some where middle of the Array
(b) The item to be searched is not in the array
(c) The item to be searched is in the last of the array
(d) The item to be searched is either in the last or not in the array


Answer is: (a) The item to be searched is in some where middle of the Array



If you are facing any queries regarding this assignment solutions, then please drop comment in comment section.

Post a Comment

0 Comments